declare global {
    interface RouterMeta {
        title: string;
    }
    interface Router {
        path: string;
        name: string;
        icon?: string;
        permission?: string;
        meta?: RouterMeta;
        component: any;
        children?: Array<Router>;
    }
    interface System {
        import(request: string): Promise<any>
    }
    var System: System
}
import login from '../views/login.vue'
import home from '../views/home/home.vue'
import main from '../views/main.vue'

export const locking = {
    path: '/locking',
    name: 'locking',
    component: () => import('../components/lockscreen/components/locking-page.vue')
};
export const loginRouter: Router = {
    path: '/',
    name: 'login',
    meta: {
        title: 'LogIn'
    },
    component: () => import('../views/login.vue')
};
export const otherRouters: Router = {
    path: '/main',
    name: 'main',
    permission: '',
    meta: { title: 'ManageMenu' },
    component: main,
    children: [
        { path: 'home', meta: { title: 'HomePage' }, name: 'home', component: () => import('../views/home/home.vue') },
        { path: 'ownspace_index', meta: { title: 'UserProfile' }, name: 'ownspace_index', component: () => import('../views/setting/user/ownspace.vue') }
    ]
}
export const appRouters: Array<Router> = [{
    path: '/setting',
    name: 'setting',
    permission: '',
    meta: { title: 'UserAndRole' },
    icon: '&#xe64b;',
    component: main,
    children: [
        { path: 'user', permission: 'Pages.Users', meta: { title: 'Users' }, icon: '&#xe66f;', name: 'user', component: () => import('../views/setting/user/user.vue') },
        { path: 'role', permission: 'Pages.Roles', meta: { title: 'Roles' }, icon: '&#xe66d;', name: 'role', component: () => import('../views/setting/role/role.vue') },
        { path: 'tenant', permission: 'Pages.Tenants', meta: { title: 'Tenants' }, name: 'tenant', component: () => import('../views/setting/tenant/tenant.vue') }
    ]
},{
    path: '/content',
    name: 'content',
    permission:'',
    meta: {title: 'ContentManage'},
    icon:'&#xe668;',
    component: main,
    children: [
        { path: 'news-category', permission: 'Pages.NewsCategory', icon:'&#xe60a;',  meta: { title: 'NewsCategory' }, name: 'newsCategory', component: () => import('../views/articles/articleCate/article-cate.vue') },
        { path: 'news', permission: 'Pages.News', icon: '&#xe850;', meta: { title: 'NewsManager' }, name: 'news', component: () => import('../views/articles/News.vue') }
    ]
},{
    path: '/estate',
    name: 'estate',
    permission:'',
    meta: {title: 'EstateInfo'},
    icon:'&#xe626;',
    component: main,
    children: [
        { path: 'village', permission: 'Pages.Village', icon:'&#xe622;',  meta: { title: 'Village' }, name: 'vllage', component: () => import('../views/estate/villages/Village.vue') },
        { path: 'floor', permission: 'Pages.Floor', icon: '&#xe677;', meta: { title: 'NewFloor' }, name: 'floor', component: () => import('../views/estate/floors/Floor.vue') },
        { path: 'secondHand', permission: 'Pages.SecondHand', icon: '&#xe6a1;', meta: { title: 'SecondHand' }, name: 'secondHand', component: () => import('../views/seconds/SecondHand.vue') }
    ]
},{
    path: '/buy',
    name: 'buy',
    permission:'',
    meta: {title: 'GroupBuyManager'},
    icon:'&#xe672;',
    component: main,
    children: [
        { path: 'buy-type', permission: 'Pages.GroupBuy', icon:'&#xe644;', meta: { title: 'GroupBuyType' }, name: 'buyType', component: () => import('../views/buyType/GroupBuyType.vue') },
        { path: 'group', permission: 'Pages.GroupBuy', icon:'&#xe672;', meta: { title: 'GroupBuyManager' }, name: 'groupBuy', component: () => import('../views/groupBuy/GroupBuy.vue') },
        { path: 'groupItem', permission: 'Pages.GroupBuy', icon:'&#xe635;', meta: { title: 'GroupItemManager' }, name: 'groupItem', component: () => import('../views/groupItem/GroupItem.vue') },
    ]
},{
    path: '/system',
    name: 'system',
    permission:'',
    meta: {title: 'SystemSettings'},
    icon:'&#xe64b;',
    component: main,
    children: [
        { path: 'region', permission: 'Pages.System.Region', icon:'&#xe671;', meta: { title: 'RegionManager' }, name: 'region', component: () => import('../views/system/region.vue') },
    ]
}]
export const routers = [
    loginRouter,
    locking,
    ...appRouters,
    otherRouters
];
